wayland: Fix return value of get_device_state
authorMatthias Clasen <mclasen@redhat.com>
Wed, 26 Aug 2020 20:32:31 +0000 (16:32 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 26 Aug 2020 21:56:41 +0000 (17:56 -0400)
We need to look a the position, not the child surface.

gdk/wayland/gdksurface-wayland.c

index b6ff57a5b04d27069947abce2749e09d0302938e..45769984ea76a4290ef44cd652358509a1e0181b 100644 (file)
@@ -3170,21 +3170,12 @@ gdk_wayland_surface_get_device_state (GdkSurface       *surface,
                                       double           *y,
                                       GdkModifierType  *mask)
 {
-  gboolean return_val;
-
-  g_return_val_if_fail (surface == NULL || GDK_IS_SURFACE (surface), FALSE);
-
-  return_val = TRUE;
-
-  if (!GDK_SURFACE_DESTROYED (surface))
-    {
-      GdkSurface *child;
+  if (GDK_SURFACE_DESTROYED (surface))
+    return FALSE;
 
-      gdk_wayland_device_query_state (device, surface, &child, x, y, mask);
-      return_val = (child != NULL);
-    }
+  gdk_wayland_device_query_state (device, surface, NULL, x, y, mask);
 
-  return return_val;
+  return *x >= 0 && *y >= 0 && *x < surface->width && *y < surface->height;
 }
 
 static void